package chang.controller;

import chang.model.response.Response;
import chang.service.RepairService;
import chang.service.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/student/md/")
@Api(tags = "Student端获取数据")
public class StudentController {

    @Autowired
    StudentService studentService;

    @Autowired
    RepairService repairService;

    /**
     * 获取轮播图的图片路径
     * @return
     */
    @GetMapping("getViewPager")
    @ApiOperation("获取轮播图")
    public Response getViewPager(){
        return studentService.getViewPager();
    }

    /**
     * 获取菜单项
     * @return
     */
    @GetMapping("getMenuItem")
    @ApiOperation("获取菜单项")
    public Response getMenuItem(){
        return studentService.getMenuItem();
    }

    @GetMapping("getRepair/{xh}")
    @ApiOperation("获取重修信息")
    public Response getRepair(@PathVariable("xh") String xh){
        return repairService.findPageByName(xh, "");
    }

    @GetMapping("getAllPhoneCode")
    @ApiOperation("获取手机号码列表")
    public Response getAllPhoneCode(){
        return studentService.getAllPhoneCode();
    }

    @GetMapping("getPhoneCode/{name}")
    @ApiOperation("根据名字模糊查询")
    public Response findPhoneCodeByName(@PathVariable String name){
        return studentService.findPhoneCodeByName(name);
    }

}
